package com.lmy.pool;

import java.util.Date;

public class Task implements Runnable {

    private String name;

    public Task(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        try {
            System.out.println("当前执行任务的线程名:" + Thread.currentThread().getName());
            System.out.println("name=" + name + ",startTime=" + new Date());
            Thread.sleep(3000);
            System.out.println("name=" + name + ",endTime=" + new Date());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
